<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
      <el-form-item label="openid" prop="openid">
        <el-input v-model="queryParams.openid" placeholder="请输入用户openid" clearable  />
      </el-form-item>
      <el-form-item label="id" prop="id">
        <el-input v-model="queryParams.id" placeholder="请输入用户id" clearable  />
      </el-form-item>
      <el-form-item label="手机号" prop="mobile">
        <el-input v-model="queryParams.mobile" placeholder="请输入手机号" clearable  />
      </el-form-item>
      <el-form-item label="昵称" prop="nickname">
        <el-input v-model="queryParams.nickname" placeholder="请输入昵称" clearable  />
      </el-form-item>
      <el-form-item label="玩家状态" prop="status">
        <el-select v-model="queryParams.status" clearable placeholder="请选择商品状态" >
          <el-option v-for="item in [
      {
        value: '0',
        label: '停用',
      },
      {
        value: '1',
        label: '正常',
      },
    ]" :key="item.value" :label="item.label" :value="item.value">
          </el-option>
        </el-select>
      </el-form-item>

      <el-form-item label="是否特权账号" prop="ifPrivate">
        <el-select v-model="queryParams.ifPrivate" clearable placeholder="请选择账号类型" >
          <el-option v-for="item in [
      {
        value: '0',
        label: '普通账号',
      },
      {
        value: '1',
        label: '特权账号',
      },
    ]" :key="item.value" :label="item.label" :value="item.value">
          </el-option>
        </el-select>
      </el-form-item>

      <el-form-item label="是否一番上特权账号" prop="ifPrivateDq">
        <el-select v-model="queryParams.ifPrivateDq" clearable placeholder="请选择账号类型" >
          <el-option v-for="item in [
      {
        value: '0',
        label: '普通账号',
      },
      {
        value: '1',
        label: '特权账号',
      },
    ]" :key="item.value" :label="item.label" :value="item.value">
          </el-option>
        </el-select>
      </el-form-item>

      <el-form-item label="创建时间" prop="addtime">
        <el-input v-model="queryParams.addtime" placeholder="请输入添加时间" clearable  />
      </el-form-item>

      <!-- <el-form-item label="提现密码" prop="password2">
        <el-input
          v-model="queryParams.password2"
          placeholder="请输入提现密码"
          clearable
          
        />
      </el-form-item> -->
      <!-- <el-form-item label="父级id" prop="pid">
        <el-input
          v-model="queryParams.pid"
          placeholder="请输入父级id"
          clearable
          
        />
      </el-form-item> -->
      <el-form-item label="余额" prop="money">
        <el-input v-model="queryParams.money" placeholder="请输入余额" clearable  />
      </el-form-item>
      <el-form-item label="积分" prop="jifen">
        <el-input v-model="queryParams.jifen" placeholder="请输入积分" clearable  />
      </el-form-item>
      <!-- <el-form-item label="${comment}" prop="creator">
        <el-input
          v-model="queryParams.creator"
          placeholder="请输入${comment}"
          clearable
          
        />
      </el-form-item> -->
      <el-form-item label="创建时间" prop="addtime">
        <el-date-picker clearable v-model="queryParams.addtime" type="date" value-format="yyyy-MM-dd"
          placeholder="请选择创建时间">
        </el-date-picker>
      </el-form-item>
      <el-form-item label="vip" prop="vip">
        <el-input v-model="queryParams.vip" placeholder="请输入vip" clearable  />
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>

    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
          v-hasPermi="['system:my-user:add']">新增</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button type="success" plain icon="el-icon-edit" size="mini" :disabled="single" @click="handleUpdate"
          v-hasPermi="['system:my-user:edit']">修改</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button type="danger" plain icon="el-icon-delete" size="mini" @click="handleDelete_all"
          v-hasPermi="['system:my-user:remove']">一键下线</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport"
          v-hasPermi="['system:my-user:export']">导出</el-button>
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

    <el-table v-loading="loading" :data="my_userList" @selection-change="handleSelectionChange"
      @sort-change="dataListSortChangeHandle">
      <el-table-column type="selection" width="55" align="center" />
      <el-table-column sortable="custom" label="ID" width="55" align="center" prop="openid" />
      <!-- <el-table-column label="微信openid" align="center" prop="openid" /> -->

      <el-table-column label="昵称" align="center" prop="nickname" />
      <el-table-column label="头像" align="center" prop="headimg">
        <template slot-scope="scope">
          <el-avatar :src="scope.row.headimg"></el-avatar>
        </template>
      </el-table-column>
      <el-table-column label="头像框" align="center" prop="headimg">
        <template slot-scope="scope">
          <el-avatar :src="scope.row.username_tou" v-if="scope.row.username_tou"></el-avatar>
          <div v-else>暂无头像框</div>
        </template>
      </el-table-column>
      <el-table-column label="称号" align="center" prop="headimg" width="120">
        <template slot-scope="scope">
          <el-image v-if="scope.row.appellation" :src="scope.row.appellation"
            style="width: 100px;height:50px"></el-image>
          <div v-else>暂无称号</div>
        </template>
      </el-table-column>

      <el-table-column label="手机号" align="center" prop="mobile" />
      <el-table-column sortable="custom" label="状态" align="center" prop="status">
        <template slot-scope="scope">
          <el-tag v-if="scope.row.status == 1" type="success">正常</el-tag>
          <el-tag v-if="scope.row.status == -1" type="danger">禁用</el-tag>
          <div v-if="scope.row.status == -1">
            {{ formatSeconds(scope.row.remainingTime) }}
          </div>
        </template>
      </el-table-column>
      <!-- <el-table-column label="提现密码" align="center" prop="password2" />
      <el-table-column label="父级id" align="center" prop="pid" /> -->
      <el-table-column sortable="custom" label="余额" align="center" prop="money">
        <template slot-scope="scope">
          <div>{{ scope.row.money }}</div>
          <el-button size="mini" v-hasPermi="['system:my-user:money_cz']" type="success"
            @click.enter="cz(scope.row, 0)">充值</el-button>
        </template>
      </el-table-column>
      <el-table-column sortable="custom" label="积分" align="center" prop="jifen">
        <template slot-scope="scope">
          <div>{{ scope.row.jifen }}</div>
          <el-button v-hasPermi="['system:my-user:jf_cz']" size="mini" type="success" @click="cz(scope.row, 1)">充值
          </el-button>
        </template>
      </el-table-column>
      <el-table-column sortable="custom" label="M币" align="center" prop="mb">
        <template slot-scope="scope">
          <div>{{ scope.row.mb }}</div>
          <el-button size="mini" v-hasPermi="['system:my-user:Mb_cz']" type="success" @click="czMb(scope.row, 1)">充值
          </el-button>
        </template>
      </el-table-column>
      <!-- <el-table-column label="${comment}" align="center" prop="creator" /> -->
      <el-table-column sortable="custom" label="创建时间" align="center" prop="createTime" width="180">
        <template slot-scope="scope">
          <span>{{
      scope.row.createTime
    }}</span>
        </template>
      </el-table-column>
      <el-table-column sortable="custom" label="最后操作时间" align="center" prop="updateTime">
        <template slot-scope="scope">
          <span>{{
          scope.row.updateTime
      }}</span>
        </template>
      </el-table-column>

      <!-- <el-table-column
       sortable="custom"
        label="玩家今日消费"
        align="center"
        prop="lastLoginTime"
      /> -->

      <el-table-column sortable="custom" label="特权账号" align="center" prop="ifPrivate">
        <template slot-scope="scope">
          <el-tag v-if="scope.row.ifPrivate == 1" type="success">是</el-tag>
          <el-tag v-if="scope.row.ifPrivate == 0" type="danger">否</el-tag>
        </template>
      </el-table-column>

      <el-table-column sortable="custom" label="一番赏特号账号" align="center" prop="ifPrivateDq">
        <template slot-scope="scope">
          <el-tag v-if="scope.row.ifPrivateDq" type="success">{{
      scope.row.ifPrivateDq
    }}</el-tag>
          <el-tag v-if="scope.row.ifPrivateDq == 0" type="danger">否</el-tag>
        </template>
      </el-table-column>

      <el-table-column sortable="custom" label="vip" align="center" prop="vip" />

      <el-table-column fixed="right" width="150" label="操作" align="center" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
            v-hasPermi="['system:my-user:edit']">修改</el-button>
          <el-button size="mini" type="text" icon="el-icon-edit" @click="handleuser(scope.row)"
            v-hasPermi="['system:my-user:info']">用户详情</el-button>
          <el-button size="mini" type="text" style="color: red" icon="el-icon-edit" @click="fenhao(scope.row)"
            v-hasPermi="['system:my-user:fenghao']">封号</el-button>
          <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
            v-hasPermi="['system:my-user:xiaxian']">下线</el-button>

          <el-button size="mini" type="text" icon="el-icon-circle-plus-outline" @click="add_shang(scope.row)"
            v-hasPermi="['system:my-user:xiaxian']">赠送赏品</el-button>
        </template>
      </el-table-column>
    </el-table>

    <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
      @pagination="getList" />

    <!-- 添加或修改用户管理对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
        <!-- <el-form-item label="微信openid" prop="openid">
          <el-input v-model="form.openid" placeholder="请输入微信openid" />
        </el-form-item> -->
        <el-form-item  label="手机号" prop="mobile">
          <el-input v-model="form.mobile" placeholder="请输入手机号" />
        </el-form-item>
        <el-form-item label="头像框" prop="avatarFrameId">
          <el-input v-model.number="form.avatarFrameId" placeholder="请输入头像框id" />
        </el-form-item>
        <el-form-item label="称号">
          <image-upload v-model="form.appellation" />
        </el-form-item>
        <!-- <el-form-item label="头像" prop="headimg">
          <el-input v-model="form.headimg" placeholder="请输入头像" />
        </el-form-item> -->
        <el-form-item  label="状态">
          <el-switch v-model.number="form.status" active-color="#13ce66" inactive-color="#F4F4F5" :active-value="1"
            :inactive-value="0">
          </el-switch>
        </el-form-item>
        <el-form-item  label="特权账号">
          <el-switch v-model.number="form.ifPrivate" active-color="#13ce66" inactive-color="#F4F4F5" :active-value="1"
            :inactive-value="0">
          </el-switch>
        </el-form-item>

        <el-form-item  label="一番赏特号账号">
          <!-- <el-switch
            v-model.number="form.ifPrivateDq"
            active-color="#13ce66"
            inactive-color="#F4F4F5"
            :active-value="1"
            :inactive-value="0"
          >
          </el-switch> -->
          <el-input v-model="form.ifPrivateDq" placeholder="请输入一番赏特号账号" />
        </el-form-item>

        <el-form-item  label="提现密码" prop="password2">
          <el-input v-model="form.password2" placeholder="请输入提现密码" />
        </el-form-item>
        <!-- <el-form-item label="父级id" prop="pid">
          <el-input v-model="form.pid" placeholder="请输入父级id" />
        </el-form-item> -->
        <!-- <el-form-item label="余额" prop="money">
          <el-input v-model="form.money" placeholder="请输入余额" />
        </el-form-item>
        <el-form-item label="积分" prop="jifen">
          <el-input v-model="form.jifen" placeholder="请输入积分" />
        </el-form-item> -->

        <el-form-item  label="vip" prop="vip">
          <el-input v-model="form.vip" placeholder="请输入vip" />
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>

    <el-dialog width="400px" top="40vh" :title="title_cz" :visible.sync="dialogFormVisible">
      <el-form :model="form_cz">
        <el-form-item label="充值" >
          <el-input-number v-model="form_cz.num" controls-position="right"></el-input-number>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="dialogFormVisible = false">取 消</el-button>
        <el-button type="primary" @click="cz1()">充值</el-button>
      </div>
    </el-dialog>

    <el-dialog width="400px" top="40vh" title="封号操作" :visible.sync="open_fenhao">
      <el-form :model="form_fh">
        <el-form-item label="封禁时间">
          <el-input-number v-model="form_fh.time" controls-position="right"></el-input-number>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="open_fenhao = false">取 消</el-button>
        <el-button type="primary" @click="fenghao1">封禁</el-button>
      </div>
    </el-dialog>

    <!-- 添加赏品 -->
    <el-dialog width="400px" top="40vh" title="添加赏品" :visible.sync="open_shang">
      <!-- 快捷导入 -->
      <el-button type="primary" @click="dialogVisible12 = true">快捷导入商品id</el-button>
      <el-form :model="form_shang">
        <el-form-item label="用户" prop="userId">
          <el-input disabled v-model="form_shang.userId" />
        </el-form-item>
        <el-form-item label="赏品" prop="goodsListId">
          <el-input v-model="form_shang.goodsListId" placeholder="请输入赏品" />
        </el-form-item>
        <el-form-item label="数量" prop="num">
          <el-input v-model.number="form_shang.num" placeholder="请输入数量" />
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="open_shang = false">取 消</el-button>
        <el-button type="primary" @click="add_shang1">添加</el-button>
      </div>
    </el-dialog>
    <!-- 快捷导入 -->
    <el-dialog title="快捷导入" :visible.sync="dialogVisible12" width="50%" center :close-on-click-modal="false">
      <importForm @func="update" />
    </el-dialog>
  </div>
</template>

<script>
import {
  listMy_user,
  getMy_user,
  delMy_user,
  addMy_user,
  updateMy_user,
  cz,
  fenghao,
  czMb,
  getMy_user_chang_tq,
  sendGoodsToUserShangDai,
  getMy_user_chang_fh
} from "@/api/users/user.js";
import importForm from "@/components/importForm";
import { listFrames, getFrames } from "@/api/system/frames";

import axios from "axios";

export default {
  name: "Userlist",
  components: {
    importForm
  },
  data() {
    return {
      form_fh: {
        time: "",
        openId: "",
      },

      open_shang: false,
      form_shang: {
        goodsListId: "",
        userId: "",
        num: 0
      },
      dialogVisible12: false,

      cz_ifmb: null,

      open_fenhao: false,
      form_cz: {
        num: 0,
      },
      cz_user: null,
      cz_type: null,
      dialogFormVisible: false,
      title_cz: "",
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 用户管理表格数据
      my_userList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        isAsc: "desc", // 排序，asc／desc
        orderByColumn: "addtime", // 排序，字段
        pageNum: 1,
        pageSize: 10,
        id: null,
        mobile: null,
        nickname: null,
        headimg: null,
        addtime: null,
        lastLoginTime: null,
        status: null,
        password2: null,
        pid: null,
        money: null,
        jifen: null,
        creator: null,
        createDate: null,
        vip: null,
        ifPrivateDq: null,
        ifPrivate: null,
        appellation: null,
      },
      // 表单参数
      form: {
        id: "",
        openid: "",
        mobile: "",
        nickname: "",
        headimg: "",
        addtime: "",
        updateTime: "",
        lastLoginTime: "",
        status: "",
        password2: "",
        pid: "",
        money: "",
        jifen: "",
        creator: "",
        createDate: "",
        vip: "",
        ifPrivate: "",
        appellation: "",
      },
      // 表单校验
      rules: {},
    };
  },
  //过滤器
  filters: {
    //将秒数转化为时分秒
    formatSeconds: function (value) {
      var secondTime = parseInt(value); // 秒
      var minuteTime = 0; // 分
      var hourTime = 0; // 小时
      if (secondTime > 60) {
        minuteTime = parseInt(secondTime / 60);
        secondTime = parseInt(secondTime % 60);
      }
      if (minuteTime > 60) {
        hourTime = parseInt(minuteTime / 60);
        minuteTime = parseInt(minuteTime % 60);
      }
      var result =
        "" +
        parseInt(secondTime) +
        "秒" +
        parseInt(minuteTime) +
        "分" +
        parseInt(hourTime) +
        "小时";
      return result;
    },
  },

  created() {
    this.getList();
  },
  methods: {
    update(res) {
      console.log(res);
      this.form_shang.goodsListId = res.id;
      this.dialogVisible12 = false;
    },

    add_shang1() {
      console.log(this.form_shang);
      //添加确认提示
      this.$confirm("是否添加赏品", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          sendGoodsToUserShangDai(this.form_shang).then((res) => {
            this.dialogVisible12 = false;
            this.$modal.msgSuccess("添加成功");
          });
        })
        .catch(() => { });
    },

    cz1() {
      this.dialogFormVisible = false;
      console.log(this.form_cz.num);
      if (this.cz_ifmb == 1) {
        cz({
          change: this.form_cz.num,
          userId: this.cz_user,
          type: this.cz_type,
        }).then((res) => {
          this.$modal.msgSuccess("充值成功");
          this.getList();
        });
      } else {
        czMb({
          mb: this.form_cz.num,
          userId: this.cz_user,
        }).then((res) => {
          this.$modal.msgSuccess("充值成功");
          this.getList();
        });
      }
    },
    cz(row, type) {
      this.cz_ifmb = 1;
      this.cz_type = type;
      this.cz_user = row.id;
      this.title_cz = `对${row.nickname}用户进行${type ? "积分" : "余额"}充值`;
      console.log(row, type);
      this.dialogFormVisible = true;
    },
    czMb(row, type) {
      this.cz_ifmb = 2;

      this.cz_user = row.id;
      this.title_cz = `对${row.nickname}用户进行M币赠送`;
      console.log(row, type);
      this.dialogFormVisible = true;
    },

    //用户封号
    fenhao(row) {
      console.log(row.openid);
      this.form_fh.openId = row.openid;
      this.open_fenhao = true;
    },

    fenghao1() {
      this.open_fenhao = false;
      getMy_user_chang_fh(this.form_fh.openId, this.form_fh.time).then((res) => {
        this.$modal.msgSuccess("封号成功");
        this.getList();
      });


      // fenghao({
      //   openId: this.form_fh.openId,
      //   time: this.form_fh.time,
      // }).then((res) => {
      //   this.getList();
      // });
    },

    //查询头像框
    async queryUser_tou(arr) {
      console.log(arr);
      let val = arr;
      for (let index = 0; index < arr.length; index++) {
        console.log('查询头像框');
        console.log(arr[index].avatarFrameId);
        if (arr[index].avatarFrameId) {
          await getFrames(arr[index].avatarFrameId).then((response) => {
            if (response.data) {
              this.$set(
                this.my_userList[index],
                "username_tou",
                response.data.frameUrl
              );
              console.log(this.my_userList);
            }
          });
        }
      }
    },

    /** 查询用户管理列表 */
    getList() {
      this.loading = true;
      listMy_user(this.queryParams).then((response) => {
        this.my_userList = response.rows;
        this.queryUser_tou(response.rows);
        this.total = response.total;
        this.loading = false;
      });
    },

    //计算特权账号余额
    jisuan(list) {
      this.yfs_num = 0;
      list.array.forEach((element) => {
        this.yfs_num += element.money - element;
      });
    },

    //设置用户打拳特权
    getMy_user_chang_tq() {
      console.log('设置一番上特权成功');
      getMy_user_chang_tq(this.form.id).then(res => {

        this.$modal.msgSuccess("设置一番上特权成功");
      })
    },

    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        id: null,
        openid: null,
        mobile: null,
        nickname: null,
        headimg: null,
        addtime: null,
        updateTime: null,
        lastLoginTime: null,
        status: "",
        password2: null,
        pid: null,
        money: null,
        jifen: null,
        creator: null,
        createDate: null,
        vip: null,
        avatarFrameId: null,
        appellation: null,
      };
      this.resetForm("form");
    },
    //添加赏品
    add_shang(row) {
      this.open_shang = true;
      this.form_shang.userId = row.id

    },

    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;

      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.queryParams.orderByColumn = "";
      this.queryParams.isAsc = "";
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map((item) => item.id);
      this.single = selection.length !== 1;
      this.multiple = !selection.length;
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "添加用户管理";
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const id = row.id || this.ids;
      getMy_user(id).then((response) => {
        // this.form = response.data;
        (this.form = {
          id: response.data.id,
          openid: response.data.openid,
          mobile: response.data.mobile,
          ifPrivate: response.data.ifPrivate,
          addtime: "",
          updateTime: 0,
          lastLoginTime: 0,
          status: response.data.status,
          password2: response.data.password2 ? response.data.password2 : "",
          pid: "",
          money: response.data.money,
          jifen: response.data.jifen,
          creator: "",
          createDate: "",
          avatarFrameId: response.data.avatarFrameId,
          vip: response.data.vip ? response.data.vip : "",
          ifPrivateDq: response.data.ifPrivateDq,
          appellation: response.data.appellation,
        }),
          (this.open = true);
        this.title = "修改用户管理";
      });
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate((valid) => {
        if (valid) {
          if (this.form.id != null) {
            updateMy_user(this.form).then((response) => {

              this.$modal.msgSuccess("修改成功");
              if (this.form.ifPrivateDq != 0) {
                this.getMy_user_chang_tq()
              }

              this.open = false;
              this.getList();
            });
          } else {
            addMy_user(this.form).then((response) => {
              this.$modal.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            });
          }
        }
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const ids = row.id || this.ids;
      console.log(row.openid);

      axios
        .post(
          "https://m.manoushang.com:30817/manou/common/kickoutQaedjcdjnd?openId=" +
          row.openid
        )
        .then((res) => {
          this.$modal.msgSuccess("下线成功");
          this.getList();
        })
        .catch((err) => { });
    },
    handleDelete_all() {
      axios
        .post("https://m.manoushang.com:30817/manou/common/kickoutQaedjcdjnd")
        .then((res) => {
          this.$modal.msgSuccess("全部下线成功");
          this.getList();
        })
        .catch((err) => { });
    },

    /** 导出按钮操作 */
    handleExport() {
      this.download(
        "system/my-user/export",
        {
          ...this.queryParams,
        },
        `my-user_${new Date().getTime()}.xlsx`
      );
    },
    //查看用户详情
    handleuser(row) {
      const tableId = row.id;
      const tableName = row.nickname;
      //   const params = { pageNum: this.queryParams.pageNum };
      console.log(row);
      this.$tab.openPage(
        "查看[" + tableName + "]用户详情",
        "/users/user_xq/index/" + tableId
      );
    },
    //排序
    dataListSortChangeHandle(data) {
      if (!data.order || !data.prop) {
        this.queryParams.orderByColumn = "";
        this.queryParams.isAsc = "";
        return false;
      }
      this.queryParams.isAsc = data.order.replace(/ending$/, "");
      this.queryParams.orderByColumn = data.prop
        .replace(/([A-Z])/g, "_$1")
        .toLowerCase();
      this.getList();
    },
  },
};
</script>
